package com.jprocms.module.cms.es.vo;

import com.jprocms.module.cms.dal.dataobject.channel.ChannelDO;
import com.jprocms.module.cms.web.IPageUrl;
import com.jprocms.module.cms.web.IUrl;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;
import java.util.Map;

import static com.jpro.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
 * @author jprocms
 */
@Data
@Schema(description = "内容es  VO")
public class EsContentVO implements IPageUrl, IUrl {
    @Schema(description = "id")
    private Long id;
    @Schema(description = "标题")
    private String title;
    @Schema(description = "副标题")
    private String subtitle;
    @Schema(description = "状态(1:已发布;   2:流转中;   3:待发布;  4:退回;  5:下线  6:草稿;   7 删除    8彻底删除 9归档")
    private Integer status;
    @Schema(description = "所属栏目")
    private Long channelId;
    @Schema(description = "所属栏目名称")
    private String channelName;
    @Schema(description = "所属站点")
    private Long siteId;
    @Schema(description = "所属站点名称")
    private String siteName;
    @Schema(description = "作者")
    private String author;
    @Schema(description = "创建者")
    private String createUser;
    @Schema(description = "创建类型 1:直接创建    2:投稿  3:引用  4:复制")
    private Integer createMode;

    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private Date createTime;

    @Schema(description = "发布时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private Date releaseTime;
    @Schema(description = "所属标记id")
    private Long dictMark;
    @Schema(description = "所属区块id")
    private Long dictBlock;

    @Schema(description = "系统图片")
    private String sysImage;
    @Schema(description = "系统视频")
    private String sysVideo;
    @Schema(description = "系统视频")
    private String sysAudio;
    @Schema(description = "系统附件")
    private String sysAttach;
    @Schema(description = "系统附件名称")
    private String sysAttachName;
    @Schema(description = "文库")
    private String docPdf;
    @Schema(description = "文库原始文档")
    private String originDoc;
    @Schema(description = "文库文档名称")
    private String docName;
    @Schema(description = "描述")
    private String description;
    @Schema(description = "关键词")
    private String keywords;
    @Schema(description = "来源")
    private String source;
    @Schema(description = "模型id")
    private Long modelId;
    @Schema(description = "置顶排序值")
    private Integer topLevel;

    @Schema(description = "tag词id")
    private List<Long> tagIds;

    @Schema(description = "url")
    private String url;
    @Schema(description = "原文内容ID")
    private Long originContentId;
    @Schema(description = "扩展字段")
    private Map<String, Object> customs;

    @Schema(description = "点赞数")
    private Integer ups;
    @Schema(description = "点踩数")
    private Integer downs;
    @Schema(description = "总评论量")
    private Integer comments;
    @Schema(description = "浏览量")
    private Integer views;
    @Schema(description = "下载量")
    private Integer downloads;
    @Schema(description = "收藏人数")
    private Long favorites;

    @Schema(description = "标题（含高亮标识）")
    private String highlightTitle;

    @Schema(description = "正文（含高亮标识）")
    private String highlightTxt;

    private Map<String, List<String>> highlight;

    private String dynamicUrl;

    //为了搜索页面显示内容面包屑
    private ChannelDO channel;
    private Boolean targetBlank = false;


    @Schema(description = "外部链接")
    private String outLink;

    @Schema(description = "默认正文")
    private String text;

    @Override
    public String getName() {
        return getTitle();
    }

    @Override
    public Boolean getTargetBlank() {
        return targetBlank;
    }

    @Override
    public String getUrl(long page) {
        return url;
    }

    @Override
    public String getDynamicUrl(long page) {
        return dynamicUrl;
    }
}
